package com.xingzuo.library_user.ui.fragment;

import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.xingzuo.base.app.AppActivityKey;
import com.xingzuo.base.ui.mvp.base.ui.BaseFragment;
import com.xingzuo.library_user.R;
import com.xingzuo.library_user.R2;
import com.xingzuo.library_user.adapter.UserListAdapter;
import com.xingzuo.library_user.bean.UserListBean;
import com.xingzuo.library_user.dialog.UserBriefDialog;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

@Route(path = AppActivityKey.USERFRAGMENT)
public class UserFragment extends BaseFragment {
    @BindView(R2.id.tv_more)
    TextView tvMore;
    @BindView(R2.id.fl_title)
    FrameLayout flTitle;
    @BindView(R2.id.iv_pic)
    ImageView ivPic;
    @BindView(R2.id.tv_name)
    TextView tvName;
    @BindView(R2.id.tv_fensi)
    TextView tvFensi;
    @BindView(R2.id.tv_guanzhu)
    TextView tvGuanzhu;
    @BindView(R2.id.tv_yunshi)
    TextView tvYunshi;
    @BindView(R2.id.tv_riqi)
    TextView tvRiqi;
    @BindView(R2.id.tv_nongli)
    TextView tvNongli;
    @BindView(R2.id.tv_yunshi_paiming)
    TextView tvYunshiPaiming;
    @BindView(R2.id.view1)
    View view1;
    @BindView(R2.id.tv_jianjie)
    TextView tvJianjie;
    @BindView(R2.id.iv_jianjie_back)
    ImageView ivJianjieBack;
    @BindView(R2.id.iv_jianjie_bianji)
    ImageView ivJianjieBianji;
    @BindView(R2.id.view2)
    View view2;
    @BindView(R2.id.tv_yuyue)
    RadioButton tvYuyue;
    @BindView(R2.id.tv_message)
    RadioButton tvMessage;
    @BindView(R2.id.tv_anli)
    RadioButton tvAnli;
    @BindView(R2.id.tv_jiedu)
    RadioButton tvJiedu;
    @BindView(R2.id.rg_mune)
    RadioGroup rgMune;
    @BindView(R2.id.view3)
    View view3;
    @BindView(R2.id.rv_list)
    RecyclerView rvList;
    private UserListAdapter adapter;
    private List<UserListBean> listBeans=new ArrayList<>();
    @Override
    public int getViewId() {
        return R.layout.fragment_user;
    }

    @Override
    public void initView() {
        rvList.setLayoutManager(new LinearLayoutManager(mContext));
        adapter=new UserListAdapter(R.layout.item_user_list,listBeans);
        rvList.setAdapter(adapter);
    }

    @Override
    public void initLinsenterner() {

    }

    @Override
    public void getData() {
        listBeans.add(new UserListBean());
        listBeans.add(new UserListBean());
        listBeans.add(new UserListBean());
        listBeans.add(new UserListBean());
    }

    @OnClick({R2.id.tv_more, R2.id.tv_yuyue, R2.id.tv_message, R2.id.tv_anli, R2.id.tv_jiedu})
    public void onViewClicked(View view) {
        int id = view.getId();
        if (id == R.id.tv_more) {
            startIntent(AppActivityKey.MOREACTIVITY);
        } else if (id == R.id.tv_yuyue) {
            startIntent(AppActivityKey.APPOINTMENTACTIVITY);
        } else if (id == R.id.tv_message) {
            startIntent(AppActivityKey.MESSAGEACTIVITY);
        } else if (id == R.id.tv_anli) {
            startIntent(AppActivityKey.MYCASEACTIVITY);
        } else if (id == R.id.tv_jiedu) {
            startIntent(AppActivityKey.UNSCRAMBLEACTIVITY);
        }
    }

    @OnClick(R2.id.iv_pic)
    public void onIvPicClicked() {
        startIntent(AppActivityKey.USERDETAILACTIVITY);
    }

    @OnClick(R2.id.tv_guanzhu)
    public void onTvGuanzhuClicked() {
        startIntent(AppActivityKey.CONCERNACTIVITY);
    }

    @OnClick(R2.id.iv_jianjie_bianji)
    public void onViewClicked() {
        UserBriefDialog dialog = new UserBriefDialog(mContext);
        dialog.show();
    }
}